package dup.login.demo.converter;

import dup.login.demo.domain.User;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class StringToUserConverter implements Converter<String, User> {
    @Override
    public User convert(String userStr) {
        User user = new User();
        String[] strArr = userStr.split(":");
        Integer id = Integer.parseInt(strArr[0]);
        String name = strArr[1];
        user.setId(id);
        user.setName(name);
        return user;
    }
}
